/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */

#ifndef D_ID5DB_QUEUE_H
#define D_ID5DB_QUEUE_H

#ifndef _POSIX_PATH_MAX
    #define _POSIX_PATH_MAX 1024
#endif

#define MMAP_FILE_ID_LEN 8
#define MMAP_FILE_SUFFIX ".id5db"
#define MMAP_FILE_COMPRESSED_SUFFIX ".tar.id5"
#define MMAP_FILESIZE 1073741824

struct queue_block_t
{
    int block_id;
    int mmap_fd;
    char mmap_filename[_POSIX_PATH_MAX];
    char mmap_filename_c[_POSIX_PATH_MAX];
    char *mmap_addr;
};

void id5db_queue_init(const char *, size_t);
char * check_mmap_by_item(uint64_t, struct queue_block_t *);
int id5db_queue_store_item(char *, int *);
char * id5db_queue_get_item(int *, uint64_t *);

#endif  /* id5db_queue.h */
